const mongoose = require('mongoose');
// 连接数据库
mongoose.connect( 'mongodb://127.0.0.1:27017/frontend', {useNewUrlParser: true});
// 配置数据库映像
var userSchema = new mongoose.Schema({
    name:String,
    collects:[
        {
            name:String,
            age:String,
            like:String,
            state:Boolean,
            imageUrl:String
        }
    ]
},
//去除版本号__v
{versionKey: false}
);
// 读取数据库
var userModel = mongoose.model("User",userSchema,"users");
module.exports=userModel;